<!--{include manage_header}-->
<script>   
function loadSmsTemplate(id){   
  window.location.href = WEB_ROOT + '/manage/system/sms.php?id='+id+'&s={$s}';
}

function insertText(obj,str) {
	obj.focus();
    if (document.selection) {
        var sel = document.selection.createRange();
        sel.text = str;
    } else if (typeof obj.selectionStart === 'number' && typeof obj.selectionEnd === 'number') {
        var startPos = obj.selectionStart,
            endPos = obj.selectionEnd,
            cursorPos = startPos,
            tmpStr = obj.value;
        obj.value = tmpStr.substring(0, startPos) + str + tmpStr.substring(endPos, tmpStr.length);
        cursorPos += str.length;
        obj.selectionStart = obj.selectionEnd = cursorPos;
    } else {
        obj.value += str;
    }
}
function moveEnd(obj){
    obj.focus();
    var len = obj.value.length;
    if (document.selection) {
        var sel = obj.createTextRange();
        sel.moveStart('character',len);
        sel.collapse();
        sel.select();
    } else if (typeof obj.selectionStart == 'number' && typeof obj.selectionEnd == 'number') {
        obj.selectionStart = obj.selectionEnd = len;
    }

} 


</script>

<style type="text/css"> 
.templatebutton {
    color: #FF5555;
    text-decoration: none;
    text-align: center;
    border-right: 1px solid #FFAAAA;
    border-bottom: 1px solid #FFAAAA;
    background-color: #FFDDDD;
    padding: 3px 3px 2px 3px;
    cursor:hand;
    line-height: 200%;
}
.templatebutton:hover {
    color: #FFFFFF;
    border-left: 1px solid #FF9999;
    border-top: 1px solid #FF9999;
    border-right: 1px solid #FF3333;
    border-bottom: 1px solid #FF3333;
    background-color: #FF5555;
    padding: 3px 3px 2px 3px;
}
.templatebutton a:link {
    text-decoration: none;
    color: #FF5555;
    text-align: center;
    padding: 3px 3px 2px 3px;
}
.templatebutton a:visited {
    text-decoration: none;
    color: #FF5555;
    text-align: center;
    padding: 3px 3px 2px 3px;
}
.templatebutton a:hover {
    color: #FFFFFF;
    border-left: 1px solid #FF9999;
    border-top: 1px solid #FF9999;
    border-right: 1px solid #FF3333;
    border-bottom: 1px solid #FF3333;
    background-color: #FF5555;
    padding: 3px 3px 2px 3px;
}

.templatehint{font-size:12px;color:#989898;}
</style>
<div id="bdw" class="bdw">
<div id="bd" class="cf">
<div id="partner">
	<div class="dashboard" id="dashboard">
		<ul>${mcurrent_system('sms')}</ul>
	</div>
	<div id="content" class="clear mainwide">
        <div class="clear box">
            <div class="box-top"></div>
            <div class="box-content">
                <div class="head">
                	<h2>短信配置</h2>
                	<ul class="filter">${current_system_sms($s)}</ul>
                </div>
                <div class="sect">
                    <form method="post" id="inputForm">
						<div class="field">
							<label>短信模板选择</label>
							<select name="template_id" id="manage_system_template_id" class="f-input" onchange="loadSmsTemplate(this.options[this.selectedIndex].value);">${Utility::Option($may, $template_id, '-')}</select>
						</div>
					<!--{if $content||$template_id}-->
						<div class="field">
							<label>变量选择</label>
							<!--{loop $varbs $name $title}-->
							<span class="templatebutton" title="$title" onclick="insertText(inputForm.content,'{$name}');">{$title}</span>&nbsp;&nbsp;
							<!--{/loop}-->							
						</div>
				   <!--{if $template_id == 'manage_tpl_smscoupon.html'}-->
						<div class="field">
							<label></label>
							<div class="templatehint"><font color="red">【项目自定义内容】</font>说明：<br/>例如要在优惠券中要增加商家电话，请先在对应团购项目中的'FLV视频短片'中输入：如'商家电话：4001234567'即可</div>
						</div>
					<!--{/if}-->
						<div class="field">
							<label>内容编辑</label>
							<div style="float:left;"><textarea cols="90" rows="25" name="content">${htmlspecialchars($content)}</textarea></div>
						</div>
					<!--{/if}-->
                        <div class="act">
                            <input type="submit" value="保存" name="commit" class="formbutton"/>
                        </div>
                    </form>
                    
                </div>
            </div>
            <div class="box-bottom"></div>
        </div>
	</div>

<div id="sidebar">
</div>

</div>
</div> <!-- bd end -->
</div> <!-- bdw end -->

<!--{include manage_footer}-->
